/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package ctrl.command;

import java.util.ArrayList;
import perso.Personnage;

/**
 *
 * @author Administrateur
 */
public class CmdMove extends Command{

    public CmdMove(Personnage persoSource,int px, int py) {
        super(persoSource, null);
        setEndPosX(px);
        setEndPosY(py);
    }

  

    @Override
    public void execute(ArrayList<Personnage> listPerso) {
        System.out.println("Perso id: "+getPersoSource().id+" move mode from"+getPersoSource().px+","+getPersoSource().py+" to "+getEndPosX()+","+getEndPosY());
        Personnage[][] perso = getPersoSource().carte.getPerso();
        perso[getPersoSource().px][getPersoSource().py]=null;
        getPersoSource().px = getEndPosX();
        getPersoSource().py = getEndPosY();
        
        
        perso[getEndPosX()][getEndPosY()]=getPersoSource();
    }
    
}
